package com.guigu.xiaowenbo.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.guigu.util.PageVo;
import com.guigu.xiaowenbo.mapper.SgatherMapper;
import com.guigu.xiaowenbo.pojo.Sgather;
import com.guigu.xiaowenbo.service.SgatherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SgatherServiceImpl implements SgatherService {
    @Autowired(required = false)
    SgatherMapper sgatherMapper;
    public int insertsg(Sgather sgather){
        sgatherMapper.insertsg(sgather);
        return sgather.getId();
    }
    public PageVo selectsg(Integer num, Integer size){
        PageHelper.startPage(num,size);
        List<Sgather> list = sgatherMapper.selectsg();
        PageInfo pageInfo = new PageInfo(list);
        PageVo pageVo = new PageVo();
        pageVo.setTotal(pageInfo.getTotal());
        pageVo.setRows(pageInfo.getList());
        return pageVo;
    }
    public int updatesg(Sgather sgather){
        return sgatherMapper.updatesg(sgather);
    }
    public PageVo selectsga(Integer num,Integer size){
        PageHelper.startPage(num,size);
        List<Sgather> list = sgatherMapper.selectsga();
        PageInfo pageInfo = new PageInfo(list);
        PageVo pageVo = new PageVo();
        pageVo.setRows(pageInfo.getList());
        pageVo.setTotal(pageInfo.getTotal());
        return pageVo;
    }

    public PageVo selectsgdd(Integer num,Integer size){
        PageHelper.startPage(num,size);
        List<Sgather> list = sgatherMapper.selectsgdd();
        PageInfo pageInfo = new PageInfo(list);
        PageVo pageVo = new PageVo();
        pageVo.setRows(pageInfo.getList());
        pageVo.setTotal(pageInfo.getTotal());
        return pageVo;
    }
    public int updatesgd(String attemper,Integer gatherid){
        return sgatherMapper.updatesgd(attemper,gatherid);
    }
    public PageVo selectsgrs(Integer num,Integer size){
        PageHelper.startPage(num,size);
        List<Sgather> list = sgatherMapper.selectsgrs();
        PageInfo pageInfo = new PageInfo(list);
        PageVo pageVo = new PageVo();
        pageVo.setRows(pageInfo.getList());
        pageVo.setTotal(pageInfo.getTotal());
        return pageVo;
    }

    public int updatesgre(String gatherid,String register){
        return sgatherMapper.updatesgre(gatherid,register);
    }

    public PageVo selectsgrssh(Integer num,Integer size){
        PageHelper.startPage(num,size);
        List<Sgather> list = sgatherMapper.selectsgrssh();
        PageInfo pageInfo = new PageInfo(list);
        PageVo pageVo = new PageVo();
        pageVo.setRows(pageInfo.getList());
        pageVo.setTotal(pageInfo.getTotal());
        return pageVo;
    }

    public int updatesgresh(Sgather sgather){
        return sgatherMapper.updatesgresh(sgather);
    }

    public int updatesgreshs(Sgather sgather){
        return sgatherMapper.updatesgreshs(sgather);
    }

    public PageVo selectsgre(Integer num, Integer size){
        PageHelper.startPage(num,size);
        List<Sgather> list= sgatherMapper.selectsgre();
        PageInfo pageInfo = new PageInfo(list);
        PageVo pageVo= new PageVo();
        pageVo.setTotal(pageInfo.getTotal());
        pageVo.setRows(pageInfo.getList());
        return pageVo;
    }

    @Override
    public int insert_WZY(Sgather sgather) {
        sgatherMapper.insert_WZY(sgather);
        return sgather.getId();
    }
}
